local lao__balong = fk.CreateSkill{
  name = "lao__balong",
  tags = { Skill.Compulsory },
}

Fk:loadTranslationTable{
  ["lao__balong"] = "八龙",
  [":lao__balong"] = "锁定技，当你每回合体力值首次变化后，若你手牌中锦囊牌为唯一最多的类型，你展示手牌并摸至八张。",

  ["$lao__balong1"] = "八条大龙，听着琴曲儿跟这儿晃悠，真是了不得！",
  ["$lao__balong2"] = "一龙腾云驾雾，二龙呼风唤雨，八条龙，我哩乖乖嘞！",
}

lao__balong:addEffect(fk.HpChanged, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(lao__balong.name) and not player:isKongcheng() and
      player:usedSkillTimes(lao__balong.name, Player.HistoryTurn) == 0 then
    local turn_event = player.room.logic:getCurrentEvent():findParent(GameEvent.Turn, true)
    if turn_event == nil then return false end
    local changehp_events = player.room.logic:getEventsOfScope(GameEvent.ChangeHp, 1, function (e)
      return e.data.who == player
    end, Player.HistoryTurn)
    if #changehp_events == 1 and changehp_events[1].data == data then
      local types = { Card.TypeBasic, Card.TypeEquip, Card.TypeTrick }
      local num = {0, 0, 0}
      for i = 1, 3, 1 do
        num[i] = #table.filter(player:getCardIds("h"), function(id)
          return Fk:getCardById(id).type == types[i]
        end)
      end
      return num[3] > num[1] and num[3] > num[2]
    end
    end
  end,
  on_use = function(self, event, target, player, data)
    player:showCards(player:getCardIds("h"))
    local n = 8 - player:getHandcardNum()
    if n > 0 and not player.dead then
      player:drawCards(n, lao__balong.name)
    end
  end,
})

return lao__balong